using System;
using System.Collections.Generic;
using System.Text;
using Entities;
using DAL;

namespace BUS
{
   public  class tbHinhSanPhamBUS
    {
        public static void Insert(tbHinhSanPham hinhsp)
        {
            tbHinhSanPhamDAL hinhspDAL = new tbHinhSanPhamDAL();
            hinhspDAL.Insert(hinhsp);

        }
        public static void Uptate(tbHinhSanPham hinhsp)
        {
            tbHinhSanPhamDAL hinhspDAL = new tbHinhSanPhamDAL();
            hinhspDAL.Update(hinhsp);

        }
        public static void Delete(int iD)
        {
            tbHinhSanPhamDAL hinhspDAL = new tbHinhSanPhamDAL();
            hinhspDAL.Delete(iD);
        }
        public static tbHinhSanPhamCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbHinhSanPhamDAL hinhspDAL = new tbHinhSanPhamDAL();
            return hinhspDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbHinhSanPhamCollection GetAll()
        {
            int total = 0;
            tbHinhSanPhamDAL hinhspDAL = new tbHinhSanPhamDAL();
            return hinhspDAL.Get("where 1=1", 0, 0,
            tbHinhSanPhamColumns.MaHinh.ToString(),
            "ASC", out total);
        }
        public static tbHinhSanPham GetByID(int iD)
        {
            int total = 0;
            tbHinhSanPhamDAL hinhspDAL = new tbHinhSanPhamDAL();
            tbHinhSanPhamCollection hinhspCollection = hinhspDAL.Get("where " +
            tbHinhSanPhamColumns.MaHinh.ToString() + "=" + iD.ToString(),
            0, 0, tbHinhSanPhamColumns.MaHinh.ToString(), "ASC", out total);
            if (hinhspCollection.Count > 0)
                return hinhspCollection[0];
            return null;
        }

    }
}
